#  Name:		meminfo
#  Version:		0.5
#  Part Of:		linuxrules
#  Modified:	Sun Nov 14 2010, 20:43:57

#  See COPYING for linuxrules GPL3 licensing info.

BEGIN {
	while ((getline < "/proc/meminfo") > 0) {
		
		if ( /^MemTotal:/ )
			_mem["TOTAL"]   = int($2 / 1024)

		if ( /^MemFree:/ )
			_mem["FREE"]    = int($2 / 1024)

		if ( /^SwapCached:/ )
			_mem["SWAP"]    = int($2 / 1024)

		if ( /^Cached:/ )
			_mem["CACHED"]  = int($2 / 1024)

		if ( /^Dirty:/ )
			_mem["DIRTY"]   = int($2 / 1024)

		if ( /^Mapped:/ )
			_mem["MAPPED"]  = int($2 / 1024)

		if ( /^Shmem:/ )
			_mem["SHMEM"]   = int($2 / 1024)
	}
	close("/proc/meminfo")
}

# vim:ft=awk:
